import gradio as gr     # 导入gradio库，设置别名


def greet(name):        # 编写交互函数
    return "你好啊 " + name + "!"

def mockdeepseek(question):
    return f"接收到问题：{question}，大模型回复：我是专属人工智能（开发中）"


with gr.Blocks() as demo:   # 构建页面布局
    name = gr.Textbox(label="你的名字：", lines=5)
    output = gr.Textbox(label="输出结果：", lines=3)
    greet_btn = gr.Button("打招呼", variant="primary")
    greet_btn.click(fn=greet, inputs=name, outputs=output, api_name="greet")

    your_input = gr.Textbox(label="输入信息：")
    answer = gr.Textbox(label="DeepSeek的回答")
    send_btn = gr.Button("发送消息")
    send_btn.click(fn=mockdeepseek, inputs=your_input, outputs=answer, api_name="deepseek")


if __name__ == "__main__":
    demo.launch()
